import Vuex,{Store} from 'vuex'
 import Vue from 'vue'

 Vue.use(Vuex)

 const store = new Store({
    state:{//定义数据
        name:'李志佳',
        age:18,
        sex:1
    },
    getters:{ //计算属性 用来改变仓库数据的形态
        getSex(state){
            return state.sex===1?'女':'男'
        }
    },
    mutations:{//修改数据
        setName(state,actions){
            state.name = actions.name
        },
        setAge(state,actions){
            state.age = actions.age
        }
    }
 })

 export default store

